package com.example.service.impl;

import cn.hutool.json.JSONObject;
//import com.example.model.resp.AuditDataList;
//import com.example.model.resp.AuditDataLog;
import com.alibaba.fastjson2.JSON;
import com.example.model.logBo.DataDetail;
import com.example.service.AuditLogService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author ShiShuMin
 * @version v1.0
 * @ClassName AuditLogServiceImpl
 * @Date: 2024/10/11 15:44
 * @Description: 日志审计
 */
@Service
public class AuditLogServiceImpl implements AuditLogService {
/*
    @Override
    public List<AuditDataList> getDataList(String tenantId) {
        List<AuditDataList> list = new ArrayList<>();
        AuditDataList auditDataList = new AuditDataList();
        auditDataList.setSysId(UUID.randomUUID().toString());
        auditDataList.setDataId("89217398173981");
        auditDataList.setDataType("业务支撑");
        auditDataList.setDataName("智慧城市欧报");
        list.add(auditDataList);

        // TODO: 2024/10/11 根据租户ID查询区块链的数据
        // 需要交易时间倒序，列表需要分页
        return list;
    }

    @Override
    public List<AuditDataLog> getLogList(String sysId) {
        List<AuditDataLog> list = new ArrayList<>();
        AuditDataLog auditDataLog = new AuditDataLog();
        auditDataLog.setOperatorName("张三");
        auditDataLog.setOperatorTime("2024-10-11 13:11:11");
        auditDataLog.setModuleName("产品撞护,产品管理");
        auditDataLog.setOperatorAction("添加产品");
        JSONObject jsonObject = new JSONObject();
        jsonObject.set("服务方式","XXX");
        jsonObject.set("产品描述","XXX");
        jsonObject.set("定价配置","XXX");
        auditDataLog.setContent(jsonObject.toString());
        list.add(auditDataLog);

        // TODO: 2024/10/11 根据系统ID查询日志
        return list;
    }*/

    public static void main(String[] args) {
        List<DataDetail> list = new ArrayList<>();
        DataDetail auditDataLog = new DataDetail();
        auditDataLog.setOperatorName("张三");
        auditDataLog.setOperatorTime("2024-10-11 13:11:11");
        auditDataLog.setModuleName("产品撞护,产品管理");
        auditDataLog.setOperatorAction("添加产品");
        JSONObject jsonObject = new JSONObject();
        jsonObject.set("服务方式","XXX");
        jsonObject.set("产品描述","XXX");
        jsonObject.set("定价配置","XXX");
        auditDataLog.setContent(jsonObject.toString());
        list.add(auditDataLog);
        System.out.println(JSON.toJSON(list));
    }
}
